Base = function() {

}

Base.prototype = {
	isset: function(val) {
		if(typeof(val) === 'undefined') {
			return false;
		}
		return true;
	},
	isnull: function(val) {
		if(val === null) {
			return true;
		}
		return false;
	},
	isempty: function(val) {
		if(isset(val) || isnull(val) || val === 0 || (isString(val) ? val.replace(' ', '') == '' : false)) {
			return true;
		}
		return false;
	},
	isNum: function(val) {
		if(!isNaN(val)) {
			return true;
		}
		return false;
	},
	isString: function(val) {
		if(Object.prototype.toString.call(val) === '[object string]') {
			return true;
		}
		return false;
	},
	ajax: function(url, data, dataType, successFun, errorFun, timeoutFun, timeout, type) {
		dataType = dataType || 'json';
		timeout = timeout || 15000;
		type = type || 'POST';
		$.ajax({
			type: type,
			url: url,
			data: data,
			dataType: dataType,
			timeout: timeout,
			success: successFun,
			error: function(XHR, textStatus, errorThrown) {
				if(textStatus == 'timeout' && Base.isset(timeoutFun)) {
					timeoutFun();
				}
				else {
					errorFun(XHR, textStatus, errorThrown);
				}
			}
		});
	},
	length: function(obj) {
		var length = 0;
		for(var val in obj) {
			length++;
		}
		return length;
	}
}

var Base = new Base();